/*******************************************************************************
Run Auxiliary Files

Replication code for "Culture and gender allocation of tasks: source country 
	characteristics and the division of non-market work among US immigrants" in
	Review of Economics of the Household

Authors: Francine Blau, Lawrence Kahn, Matthew Comey, Amanda Eng, Pamela 
	Meyerhofer, and Alexander Willen
	
Date: 10/19/2020

Description: This code runs auxiliary analyses for Blau, Kahn, et al (2020)

*******************************************************************************/


/*******************************************************************************

0. Settings

Note: Make sure to set file path on line 32 and adjust replication data and code 
location as necessary on lines 35 and 36

*******************************************************************************/

clear all

***A. Directory Setting

*Set master directory
global wdir "[SET FILE PATH HERE!!]/BKCEMW Replication Materials"

*Set input folders
global data "$wdir/Data"
global code "$wdir/Code"

*Set output folders
cap mkdir "$wdir/Table Output/Auxiliary"
global aux_tables "$wdir/Table Output/Auxiliary"

cap mkdir "$wdir/Log"
global log "$wdir/Log"

*Set ado
sysdir set PERSONAL "$code/ado"


***B. Other Stata Settings

set more off
graph set window fontface "Times New Roman"


***C. Non-base commands used
ssc install outreg2, replace


***D. Log
cap log close
log using "$log/Aux_Analaysis", replace text


/*******************************************************************************

I. Auxiliary Results from Primary Sample (Other Results of Interest)

*******************************************************************************/

use "$data/main_data.dta", clear

*Set output folder
cap mkdir "$aux_tables/Other Results of Interest"
global tables "$aux_tables/Other Results of Interest"

*Set primary non-market work definitions
global nmw nmw_total  
global hwork nmw_housework
global ccare nmw_ccare


***A. Run Sample Restrictions, Generate Weighting Variable
do "$code/00_01_Primary_Sample_Restriction.do"


***B. Make Tables

**i. Controlling for gender composition of children (X1)
do "$code/03_01_Table_X1.do"

**ii. Controlling for gender composition of children interacted with GGI (X2)
do "$code/03_02_Table_X2.do"

**iii. Dropping immigrants arriving as children (X3)
do "$code/03_03_Table_X3.do"

**iv. Prioritize father source characteristics for second-generation (X4)
do "$code/03_04_Table_X4.do"

**v. Wife earning more effect for women using housework and childcare (X5)
do "$code/03_05_Table_X5.do"

**vi. Wife earning more effect for men using housework and childcare (X6)
do "$code/03_06_Table_X6.do"


/*******************************************************************************

II. Main Results Allowing for Unmarried Heterosexual Partners

*******************************************************************************/

use "$data/main_data.dta", clear

*Set output folder
cap mkdir "$aux_tables/Include Unmarried Partners"
global tables "$aux_tables/Include Unmarried Partners"

*Set primary non-market work definitions
global nmw nmw_total  
global hwork nmw_housework
global ccare nmw_ccare


***A. Run Sample Restrictions, Generate Weighting Variable
do "$code/00_02_UMP_Sample_Restriction.do"


***B. Primary Tables

**i. Table 1
do "$code/02_01_Table_1.do"

**ii. Table 2
do "$code/02_02_Table_2.do"

**iii. Table 3
do "$code/02_03_Table_3.do"

**iv. Table 4
do "$code/02_04_Table_4.do"



/*******************************************************************************

III. Wife Earns More Effect Adhereing to BKP Sample Rules and Variable Definition

*******************************************************************************/

use "$data/main_data.dta", clear

*Set output folder
cap mkdir "$aux_tables/BKP Restrictions and Vars"
global tables "$aux_tables/BKP Restrictions and Vars"

*Set BKP non-market work definitions
global nmw BKP_nmw
global hwork BKP_housework
global ccare BKP_childcare 


***A. Run BKP Sample Restrictions
do "$code/00_03_BKP_Sample_Restriction.do"


**i. Table 8
do "$code/02_08_Table_8.do"

**ii. Table 9
do "$code/02_09_Table_9.do"


log close